package com.swinboo.im.service;

import com.easemob.im.server.EMException;
import com.easemob.im.server.model.EMUser;
import com.huang.entity.result.HCollectionResult;
import com.huang.entity.result.HStringResult;

/**
 * @author Swinboo
 * @date 2022-03-16 20:54
 * @description:
 */
public interface EMUserService {
    /**
     * 创建用户
     * @return
     */
    HStringResult<EMUser> create(String username, String password) throws EMException;

    /**
     * 删除用户
     * @param username
     * @return
     */
    HStringResult<Boolean> delete(String username) throws EMException;

    /**
     * 删除所有用户
     * @return
     */
    HCollectionResult<String> deleteAll () throws EMException;

    /**
     * 在所有设备强制下线
     * @param username
     * @return
     */
    HStringResult<Boolean> forceLogoutAllDevices(String username) throws EMException;

    /**
     * 在某设备轻质下线
     * @param username
     * @param resource
     * @return
     */
    HStringResult<Boolean> forceLogoutOneDevice(String username, String resource) throws EMException;

    /**
     * 获取用户信息
     * @param username
     * @return
     */
    HStringResult<EMUser> getUserInfo(String username) throws EMException;

    /**
     * 获取用户在线状态
     * @param username
     * @return
     */
    HStringResult<Boolean> isUserOnline(String username) throws EMException;

    /**
     * 获取所有用户
     * @return
     */
    HCollectionResult<String> listAllUsers() throws EMException;

    /**
     * 分页获取用户列表
     * @param limit
     * @param cursor
     * @return
     */
    HCollectionResult<String> listUsers(int limit, String cursor) throws EMException;

    /**
     * 修改用户密码
     * @param username
     * @param password
     * @return
     */
    HStringResult<Boolean> updateUserPassword(String username, String password) throws EMException;
}
